.class public Lcom/netease/newsreader/util/PhotoGridAdapter;
.super Landroid/widget/BaseAdapter;
.source "PhotoGridAdapter.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;
    }
.end annotation


# static fields
.field public static final FLAG:Ljava/lang/String; = "picture"

.field public static final SIZE_TYPE:Ljava/lang/String; = "small"


# instance fields
.field private context:Landroid/content/Context;

.field private flag:Ljava/lang/String;

.field i:I

.field private list:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/netease/newsreader/bean/PhotosetListInfo;",
            ">;"
        }
    .end annotation
.end field

.field private mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

.field private mInflater:Landroid/view/LayoutInflater;

.field private set_prefs:Landroid/content/SharedPreferences;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 3
    .parameter "c"

    .prologue
    const/4 v2, 0x0

    .line 36
    invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V

    .line 34
    iput-object v2, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    .line 81
    const/4 v0, 0x0

    iput v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->i:I

    .line 37
    iput-object p1, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->context:Landroid/content/Context;

    .line 38
    new-instance v0, Lcom/netease/newsreader/util/BaseImageDownloader;

    iget-object v1, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->context:Landroid/content/Context;

    invoke-direct {v0, v1, v2}, Lcom/netease/newsreader/util/BaseImageDownloader;-><init>(Landroid/content/Context;Landroid/graphics/Bitmap;)V

    iput-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    .line 39
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    sget-object v1, Lcom/netease/newsreader/util/BaseImageDownloader$Mode;->CORRECT:Lcom/netease/newsreader/util/BaseImageDownloader$Mode;

    invoke-virtual {v0, v1}, Lcom/netease/newsreader/util/BaseImageDownloader;->setMode(Lcom/netease/newsreader/util/BaseImageDownloader$Mode;)V

    .line 40
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/netease/newsreader/util/BaseImageDownloader;->setThread(Ljava/lang/Thread;)V

    .line 41
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->context:Landroid/content/Context;

    invoke-static {v0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v0

    iput-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->set_prefs:Landroid/content/SharedPreferences;

    .line 43
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Ljava/lang/String;)V
    .locals 3
    .parameter "c"
    .parameter "type"

    .prologue
    const/4 v2, 0x0

    .line 46
    invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V

    .line 34
    iput-object v2, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    .line 81
    const/4 v0, 0x0

    iput v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->i:I

    .line 47
    iput-object p1, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->context:Landroid/content/Context;

    .line 48
    new-instance v0, Lcom/netease/newsreader/util/BaseImageDownloader;

    iget-object v1, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->context:Landroid/content/Context;

    invoke-direct {v0, v1, v2}, Lcom/netease/newsreader/util/BaseImageDownloader;-><init>(Landroid/content/Context;Landroid/graphics/Bitmap;)V

    iput-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    .line 49
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    sget-object v1, Lcom/netease/newsreader/util/BaseImageDownloader$Mode;->CORRECT:Lcom/netease/newsreader/util/BaseImageDownloader$Mode;

    invoke-virtual {v0, v1}, Lcom/netease/newsreader/util/BaseImageDownloader;->setMode(Lcom/netease/newsreader/util/BaseImageDownloader$Mode;)V

    .line 50
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/netease/newsreader/util/BaseImageDownloader;->setThread(Ljava/lang/Thread;)V

    .line 51
    iput-object p2, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->flag:Ljava/lang/String;

    .line 52
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->context:Landroid/content/Context;

    invoke-static {v0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v0

    iput-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->set_prefs:Landroid/content/SharedPreferences;

    .line 54
    return-void
.end method


# virtual methods
.method public getCount()I
    .locals 1

    .prologue
    .line 66
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->list:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    return v0
.end method

.method public getItem(I)Ljava/lang/Object;
    .locals 1
    .parameter "index"

    .prologue
    .line 72
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->list:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method

.method public getItemId(I)J
    .locals 2
    .parameter "position"

    .prologue
    .line 78
    int-to-long v0, p1

    return-wide v0
.end method

.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 12
    .parameter "position"
    .parameter "convertView"
    .parameter "parent"

    .prologue
    const v2, 0x7f0c0119

    const/16 v11, 0xaa

    const/16 v3, 0x6e

    const/4 v6, 0x0

    const/4 v4, 0x0

    .line 88
    if-nez p2, :cond_2

    .line 89
    new-instance v9, Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;

    invoke-direct {v9, p0, v6}, Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;-><init>(Lcom/netease/newsreader/util/PhotoGridAdapter;Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;)V

    .line 90
    .local v9, holder:Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;
    const-string v0, "small"

    iget-object v1, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->flag:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 91
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mInflater:Landroid/view/LayoutInflater;

    const v1, 0x7f03004b

    invoke-virtual {v0, v1, v6}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object p2

    .line 92
    invoke-virtual {p2, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    iput-object v0, v9, Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;->appImage:Landroid/widget/ImageView;

    .line 99
    :goto_0
    invoke-virtual {p2, v9}, Landroid/view/View;->setTag(Ljava/lang/Object;)V

    .line 105
    :goto_1
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->list:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v10

    check-cast v10, Lcom/netease/newsreader/bean/PhotosetListInfo;

    .line 106
    .local v10, photosetlistinfo:Lcom/netease/newsreader/bean/PhotosetListInfo;
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->set_prefs:Landroid/content/SharedPreferences;

    const-string v1, "downpic"

    invoke-interface {v0, v1, v4}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v8

    .line 107
    .local v8, downpic:Z
    const-string v0, "small"

    iget-object v1, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->flag:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_3

    .line 108
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->context:Landroid/content/Context;

    invoke-static {v8, v0}, Lcom/netease/newsreader/util/Tools;->isshowimg(ZLandroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 109
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-virtual {v0, v4, v4, v6}, Lcom/netease/newsreader/util/BaseImageDownloader;->setBitmapWandH(IILjava/lang/String;)V

    .line 111
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-virtual {v10}, Lcom/netease/newsreader/bean/PhotosetListInfo;->getClientcover()Ljava/lang/String;

    move-result-object v1

    iget-object v2, v9, Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;->appImage:Landroid/widget/ImageView;

    const-string v5, "Y"

    .line 112
    iget-object v4, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->context:Landroid/content/Context;

    invoke-virtual {v4}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v4

    const v6, 0x7f0200cf

    invoke-virtual {v4, v6}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v4

    check-cast v4, Landroid/graphics/drawable/BitmapDrawable;

    invoke-virtual {v4}, Landroid/graphics/drawable/BitmapDrawable;->getBitmap()Landroid/graphics/Bitmap;

    move-result-object v6

    const-string v7, "picture"

    move v4, v3

    .line 111
    invoke-virtual/range {v0 .. v7}, Lcom/netease/newsreader/util/BaseImageDownloader;->downloadPictures(Ljava/lang/String;Landroid/widget/ImageView;IILjava/lang/String;Landroid/graphics/Bitmap;Ljava/lang/String;)V

    .line 137
    :cond_0
    :goto_2
    return-object p2

    .line 94
    .end local v8           #downpic:Z
    .end local v10           #photosetlistinfo:Lcom/netease/newsreader/bean/PhotosetListInfo;
    :cond_1
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mInflater:Landroid/view/LayoutInflater;

    const v1, 0x7f03004a

    invoke-virtual {v0, v1, v6}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object p2

    .line 95
    invoke-virtual {p2, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/ImageView;

    iput-object v0, v9, Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;->appImage:Landroid/widget/ImageView;

    .line 96
    const v0, 0x7f0c011a

    invoke-virtual {p2, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, v9, Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;->appName:Landroid/widget/TextView;

    goto :goto_0

    .line 101
    .end local v9           #holder:Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;
    :cond_2
    invoke-virtual {p2}, Landroid/view/View;->getTag()Ljava/lang/Object;

    move-result-object v9

    check-cast v9, Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;

    .restart local v9       #holder:Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;
    goto :goto_1

    .line 117
    .restart local v8       #downpic:Z
    .restart local v10       #photosetlistinfo:Lcom/netease/newsreader/bean/PhotosetListInfo;
    :cond_3
    const-string v0, "0"

    invoke-virtual {v10}, Lcom/netease/newsreader/bean/PhotosetListInfo;->getSetid()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_4

    .line 119
    iget-object v0, v9, Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;->appName:Landroid/widget/TextView;

    const-string v1, ""

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 120
    iget-object v0, v9, Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;->appImage:Landroid/widget/ImageView;

    const v1, 0x7f0200d2

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageResource(I)V

    goto :goto_2

    .line 123
    :cond_4
    iget-object v1, v9, Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;->appName:Landroid/widget/TextView;

    invoke-virtual {v10}, Lcom/netease/newsreader/bean/PhotosetListInfo;->getSetname()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

    const/16 v2, 0xc

    if-le v0, v2, :cond_5

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-virtual {v10}, Lcom/netease/newsreader/bean/PhotosetListInfo;->getSetname()Ljava/lang/String;

    move-result-object v2

    const/16 v3, 0xa

    invoke-virtual {v2, v4, v3}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    invoke-direct {v0, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v2, ".."

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    :goto_3
    invoke-virtual {v1, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 124
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-virtual {v0, v4, v4, v6}, Lcom/netease/newsreader/util/BaseImageDownloader;->setBitmapWandH(IILjava/lang/String;)V

    .line 128
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->context:Landroid/content/Context;

    invoke-static {v8, v0}, Lcom/netease/newsreader/util/Tools;->isshowimg(ZLandroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 129
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-virtual {v10}, Lcom/netease/newsreader/bean/PhotosetListInfo;->getClientcover()Ljava/lang/String;

    move-result-object v1

    iget-object v2, v9, Lcom/netease/newsreader/util/PhotoGridAdapter$GridHolder;->appImage:Landroid/widget/ImageView;

    const-string v5, "Y"

    const-string v7, "picture"

    move v3, v11

    move v4, v11

    invoke-virtual/range {v0 .. v7}, Lcom/netease/newsreader/util/BaseImageDownloader;->downloadPictures(Ljava/lang/String;Landroid/widget/ImageView;IILjava/lang/String;Landroid/graphics/Bitmap;Ljava/lang/String;)V

    goto/16 :goto_2

    .line 123
    :cond_5
    invoke-virtual {v10}, Lcom/netease/newsreader/bean/PhotosetListInfo;->getSetname()Ljava/lang/String;

    move-result-object v0

    goto :goto_3
.end method

.method public setList(Ljava/util/List;)V
    .locals 2
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Lcom/netease/newsreader/bean/PhotosetListInfo;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 57
    .local p1, list:Ljava/util/List;,"Ljava/util/List<Lcom/netease/newsreader/bean/PhotosetListInfo;>;"
    iput-object p1, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->list:Ljava/util/List;

    .line 58
    iget-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->context:Landroid/content/Context;

    .line 59
    const-string v1, "layout_inflater"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/view/LayoutInflater;

    .line 58
    iput-object v0, p0, Lcom/netease/newsreader/util/PhotoGridAdapter;->mInflater:Landroid/view/LayoutInflater;

    .line 61
    return-void
.end method
